﻿using System;

namespace DatabaseConnectionExample
{
    abstract class DatabaseConnection
    {
        private TimeSpan timeout;
        private string connectionString;

        public DatabaseConnection(string connectionString, TimeSpan timeout)
        {
            ConnectionString = connectionString;
            this.timeout = timeout;
        }

        public string ConnectionString
        {
            get { return connectionString; }
            private set
            {
                if (String.IsNullOrWhiteSpace(value))
                {
                    throw new ArgumentException("Wrong connection string");
                }
                connectionString = value;
            }
        }

        public abstract void OpenConnection();

        public abstract void CloseConnection();
    }
}